package com.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.project.bean.OrderBean;
import com.project.bean.OrderDetailBean;
import com.project.bean.ShopCartBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface IOrderMapper extends BaseMapper<OrderBean> {
    IPage<OrderBean> findAll(Page<OrderBean> page, @Param("userId") int userId);

    //根据订单id查询订单详细信息集合
    List<OrderDetailBean> findByOrder(int orderId);


    /**
     * 添加订单明细
     * @param orderId 订单id
     * @param shopList 购物车集合
     */
    void addOrderDetail(@Param("orderId") int orderId, @Param("shopList") List<ShopCartBean> shopList);


    IPage<OrderBean> findByItem(Page<OrderBean> page, String status, LocalDate startDate, LocalDate endDate);
}
